/**
 */
package filesystem.impl;

import filesystem.File;
import filesystem.Filesystem;
import filesystem.FilesystemPackage;
import filesystem.Folder;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Filesystem</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link filesystem.impl.FilesystemImpl#getFoldersList <em>Folders List</em>}</li>
 *   <li>{@link filesystem.impl.FilesystemImpl#getFilesList <em>Files List</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FilesystemImpl extends EObjectImpl implements Filesystem {
	/**
	 * The cached value of the '{@link #getFoldersList() <em>Folders List</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFoldersList()
	 * @generated
	 * @ordered
	 */
	protected EList<Folder> foldersList;

	/**
	 * The cached value of the '{@link #getFilesList() <em>Files List</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFilesList()
	 * @generated
	 * @ordered
	 */
	protected EList<File> filesList;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FilesystemImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return FilesystemPackage.Literals.FILESYSTEM;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Folder> getFoldersList() {
		if (foldersList == null) {
			foldersList = new EObjectContainmentEList<Folder>(Folder.class, this, FilesystemPackage.FILESYSTEM__FOLDERS_LIST);
		}
		return foldersList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<File> getFilesList() {
		if (filesList == null) {
			filesList = new EObjectContainmentEList<File>(File.class, this, FilesystemPackage.FILESYSTEM__FILES_LIST);
		}
		return filesList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case FilesystemPackage.FILESYSTEM__FOLDERS_LIST:
				return ((InternalEList<?>)getFoldersList()).basicRemove(otherEnd, msgs);
			case FilesystemPackage.FILESYSTEM__FILES_LIST:
				return ((InternalEList<?>)getFilesList()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case FilesystemPackage.FILESYSTEM__FOLDERS_LIST:
				return getFoldersList();
			case FilesystemPackage.FILESYSTEM__FILES_LIST:
				return getFilesList();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case FilesystemPackage.FILESYSTEM__FOLDERS_LIST:
				getFoldersList().clear();
				getFoldersList().addAll((Collection<? extends Folder>)newValue);
				return;
			case FilesystemPackage.FILESYSTEM__FILES_LIST:
				getFilesList().clear();
				getFilesList().addAll((Collection<? extends File>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case FilesystemPackage.FILESYSTEM__FOLDERS_LIST:
				getFoldersList().clear();
				return;
			case FilesystemPackage.FILESYSTEM__FILES_LIST:
				getFilesList().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case FilesystemPackage.FILESYSTEM__FOLDERS_LIST:
				return foldersList != null && !foldersList.isEmpty();
			case FilesystemPackage.FILESYSTEM__FILES_LIST:
				return filesList != null && !filesList.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //FilesystemImpl
